package com.example.demo.service;

import com.example.demo.dao.StudyroomDao;
import com.example.demo.entity.StudyroomEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudyroomService {

    @Autowired
    private StudyroomDao studyroomDao;
    /**
     * 通过ID查询单条数据
     */
    public StudyroomEntity queryStudyroomById(Integer sid){
        return studyroomDao.queryStudyroomById(sid);
    }




    /**
     * 通过实体作为筛选条件查询
     */
    public List<StudyroomEntity> queryStudyroomAll(){
        return studyroomDao.queryStudyroomAll();
    }

    /**
     * 新增数据
     */
    public int insertStudyroom(StudyroomEntity studyroom){
        return studyroomDao.insertStudyroom(studyroom);
    }

    /**
     * 修改数据
     */
    public int updateStudyroom(StudyroomEntity studyroom){
        return studyroomDao.updateStudyroom(studyroom);
    }

    /**
     * 通过主键删除数据
     */
    public void deleteStudyroomById(Integer sid){
        studyroomDao.deleteStudyroomById(sid);
    }

    public StudyroomEntity queryStudyroomByName(String sname) {
        return studyroomDao.queryStudyroomByName(sname);
    }

    public List<StudyroomEntity> selectByBidStudyRoom(int bid){
        return studyroomDao.selectByBidStudyRoom(bid);
    }

}